# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-rake-compiler
_gemname=${pkgname#ruby-}
pkgver=1.1.1
pkgrel=0
pkgdesc="Provide a standard and simplified way to build and package Ruby extensions"
url="https://github.com/rake-compiler/rake-compiler"
arch="noarch"
license="MIT"
depends="ruby ruby-rake"
checkdepends="ruby-rspec"
source="$pkgname-$pkgver.tar.gz::https://github.com/rake-compiler/$_gemname/archive/v$pkgver.tar.gz
	gemfile-remove-unwanted-files.patch"
builddir="$srcdir/$_gemname-$pkgver"

build() {
	gem build $_gemname.gemspec
}

check() {
	rspec spec
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install --local \
		--install-dir "$gemdir" \
		--bindir "$pkgdir/usr/bin" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and empty directories.
	cd "$gemdir"
	rm -r cache build_info doc
}

sha512sums="e9cf9752e48eae912657a34d2f86a2b41f7d57620c6e43b1fa6fb8e5715336b2fdf99bf20a4851889e8b9b7b2e834421c13e108c538abdc3cec968952345361d  ruby-rake-compiler-1.1.1.tar.gz
beeae2e2eb9dcbcc532c18a3f08e8d6b3b4a86195851a512eb66f0c80c8d68d472e3ca0c2d056496927c7e6c0e273d02587a3dfe42bca2f87ac4934baee79af8  gemfile-remove-unwanted-files.patch"
